package com.bwie.controller;

import com.bwie.pojo.TbType;
import com.bwie.service.TbTypeService;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/19 10:29
 * @Description:
 **/
@RestController
@RequestMapping("/prod/type")
public class TypeController {

    @Autowired
    TbTypeService tbTypeService;

    /**
     * 类型树形列表
     * @return
     */
    @PostMapping("/getTreeList")
    public R getTreeList(@RequestBody TbType type){
       return tbTypeService.getTreeList(type);
    }

    /**
     * 分类树形下拉框
     * @return
     */
    @PostMapping("/getTreeselect")
    public R getTreeselect(){
        return tbTypeService.getTreeselect();
    }

    /**
     * 上传图片
     * @param file
     * @return
     */
    @PostMapping("/uploadImages")
    public R uploadImages(@RequestPart("file")MultipartFile file){
        return tbTypeService.uploadImages(file);
    }

    /**
     * 添加类型
     * @param type
     * @return
     */
    @PostMapping("/getAddType")
    public R getAddType(@RequestBody TbType type){
        return tbTypeService.getAddType(type);
    }
}
